<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>微博下拉菜单</title>
    <style>
      /* 清除元素自带样式 */
      * {
        margin: 0;
        padding: 0;
      }
      li {
        list-style: none;
      }

      .box {
        width: 60px;
        margin: 100px auto;
      }

      .box > .title-box {
        width: 60px;
        height: 30px;
        line-height: 28px;
        text-align: center;
        background-color: #eeeeee;
        padding-left: 4px;
        cursor: pointer;
        box-sizing: border-box;
      }
      .box > .title-box > span {
        font-size: 14px;
      }
      .box > .title-box > img {
        vertical-align: middle;
      }

      /* 面板 */
      .box > .panel > li {
        width: 60px;
        height: 30px;
        line-height: 28px;
        background-color: #eeeeee;
        padding-left: 10px;
        font-size: 14px;
        border-top: 1px solid #fcb273;
        box-sizing: border-box;
      }
    </style>
  </head>
  <body>
    <div class="box">
      <div class="title-box">
        <span class="title">微博</span>
        <img src="./imgs/down.png" />
      </div>

      <!-- 面板 -->
      <ul class="panel" style="display: none">
        <li>私信</li>
        <li>评论</li>
        <li>@我</li>
      </ul>
    </div>

    <script>
      var titleBox = document.querySelector('.title-box');
      var titleEle = document.querySelector('.title');
      var panel = document.querySelector('.panel');

      // 鼠标移入
      titleBox.onmouseover = function () {
        panel.style.display = 'block';
        titleEle.style.color = '#fcb273';
      };

      // 鼠标移出
      titleBox.onmouseout = function () {
        panel.style.display = 'none';
        titleEle.style.color = '#000000';
      };
    </script>
  </body>
</html>
